f57ee3a4a0bf5ac5c7c928000b3197ae68322ff4,touist-gui/src/gui/editionView/SnippetContainer.java,SnippetContainer,initPaletteContent,#PaletteType#,76
Before Change
private SnippetSection sectionSets;
public void initPaletteContent(PaletteType type) {
if (type == PaletteType.FORMULA) {
sectionConnect = new SnippetSection("Connectors");
sectionCard = new SnippetSection("Cardinality");
sectionOthers = new SnippetSection("Others");
ArrayList<Integer> snippetsAnd = new ArrayList<Integer>(){{add(0);add(1);add(7);add(8);}};
ArrayList<Integer> snippetsOr = new ArrayList<Integer>(){{add(0);add(1);add(6);add(7);}};
ArrayList<Integer> snippetsNot = new ArrayList<Integer>(){{add(4);add(5);}};
ArrayList<Integer> snippetsIf = new ArrayList<Integer>(){{add(3);add(4);add(14);add(15);add(25);add(26);}};
ArrayList<Integer> snippetsBigand = new ArrayList<Integer>(){{add(7);add(8);add(13);add(14);}};
ArrayList<Integer> snippetsXor = new ArrayList<Integer>(){{add(0);add(1);add(7);add(8);}};
ArrayList<Integer> snippetsImply = new ArrayList<Integer>(){{add(0);add(1);add(6);add(7);}};
ArrayList<Integer> snippetsEquivalent = new ArrayList<Integer>(){{add(0);add(1);add(7);add(8);}};
ArrayList<Integer> snippetsBigor = new ArrayList<Integer>(){{add(6);add(7);add(12);add(13);}};
ArrayList<Integer> snippetsAtMost = new ArrayList<Integer>(){{add(7);add(8);add(10);add(11);add(13);add(14);add(16);add(17);}};
ArrayList<Integer> snippetsAtLeast = new ArrayList<Integer>(){{add(8);add(9);add(11);add(12);add(14);add(15);add(17);add(18);}};
ArrayList<Integer> snippetsExact = new ArrayList<Integer>(){{add(6);add(7);add(9);add(10);add(12);add(13);add(15);add(16);}};
sectionConnect.addInsertButton(new InsertionButton(editorTextArea, "$a and $b", snippetsAnd, "and"));
sectionConnect.addInsertButton(new InsertionButton(editorTextArea, "$a or $b", snippetsOr, "or"));
sectionConnect.addInsertButton(new InsertionButton(editorTextArea, "not $a", snippetsNot, "not"));
sectionConnect.addInsertButton(new InsertionButton(editorTextArea, "$a xor $b", snippetsXor, "xor"));
sectionConnect.addInsertButton(new InsertionButton(editorTextArea, "$a => $b", snippetsImply, "imply"));
sectionConnect.addInsertButton(new InsertionButton(editorTextArea, "$a <=> $b", snippetsEquivalent, "is equivalent to"));
sectionConnect.addInsertButton(new InsertionButton(editorTextArea, "bigand $i in $a: \n\tp($i) \nend", snippetsBigand,"bigand"));
sectionConnect.addInsertButton(new InsertionButton(editorTextArea, "bigor $i in $a: \n\tp($i) \nend", snippetsBigor,"bigor"));
sectionCard.addInsertButton(new InsertionButton(editorTextArea, "atmost($n,$i,$s,$p)", snippetsAtMost, "at most"));
sectionCard.addInsertButton(new InsertionButton(editorTextArea, "atleast($n,$i,$s,$p)", snippetsAtLeast, "at least"));
sectionCard.addInsertButton(new InsertionButton(editorTextArea, "exact($n,$i,$s,$p)", snippetsExact, "exact"));
sectionOthers.addInsertButton(new InsertionButton(editorTextArea, "if $a \nthen \n\t$b \nelse \n\t$c\n", snippetsIf, "if then else","if\\,\\$a \\\\ then\\\\\\quad\\$b \\\\ else\\\\\\quad\\$c"));
snippetSectionsContainer.setLayout(new BoxLayout(snippetSectionsContainer, BoxLayout.Y_AXIS));
snippetSectionsContainer.add(sectionConnect);
snippetSectionsContainer.add(sectionCard);
snippetSectionsContainer.add(sectionOthers);
sectionConnect.unfold();
} else if (type == PaletteType.SET) {
sectionSets = new SnippetSection("Sets");
ArrayList<Integer> snippetsSet = new ArrayList<Integer>(){{add(0);add(1);}};
sectionSets.addInsertButton(new InsertionButton(editorTextArea, "$a = true", snippetsSet, ""));
sectionSets.addInsertButton(new InsertionButton(editorTextArea, "$a = false", snippetsSet, ""));
sectionSets.addInsertButton(new InsertionButton(editorTextArea, "$v = 0", snippetsSet, ""));
sectionSets.addInsertButton(new InsertionButton(editorTextArea, "$v = 0.0", snippetsSet, ""));
sectionSets.addInsertButton(new InsertionButton(editorTextArea, "$a = [a,b,c]", snippetsSet, ""));
snippetSectionsContainer.setLayout(new BoxLayout(snippetSectionsContainer, BoxLayout.Y_AXIS));
After Change
sectionSets.addInsertButton(new InsertionButton(editorTextArea, "$a = true", snippetsSet, ""));
sectionSets.addInsertButton(new InsertionButton(editorTextArea, "$a = false", snippetsSet, ""));
sectionSets.addInsertButton(new InsertionButton(editorTextArea, "$v = 0", snippetsSet, ""));
sectionSets.addInsertButton(new InsertionButton(editorTextArea, "$v = 0.0", snippetsSet, ""));
sectionSets.addInsertButton(new InsertionButton(editorTextArea, "$a = [a,b,c]", snippetsSet, ""));
snippetSectionsContainer.setLayout(new BoxLayout(snippetSectionsContainer, BoxLayout.Y_AXIS));